package com.example.dem5;

/**
 * @program: xian-cheng
 * @description:
 * @author: 诸葛龙辰
 * @create: 2022-11-01 09:44
 **/
public class Test {
    public static void main(String[] args) {
        Threade t1 = new Threade("A");
        Threade t2 = new Threade("B");
        Threade t3 = new Threade("C");
        Threade t4 = new Threade("窗口D");
        //优先级值越大 获取cpu的概率越高  执行完越早
        t1.setPriority(1);
        t2.setPriority(3);
        t3.setPriority(6);
        t4.setPriority(10);
        t1.start();
        t2.start();
        t3.start();
        t4.start();
    }

}
class Threade extends Thread{
    Threade(String name){
        super(name);
    }
    @Override
    public void run(){
        for (int i = 0; i <20; i++) {
            System.out.println(Thread.currentThread().getName()+"======="+i);
        }
    }
}